package test.top1.com.atguigu.utils;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * ClassName: ThreadPoolUtil
 * Package: test.top1.com.atguigu.utils
 * Description:
 *
 * @Author ChenJun(有志男青年)
 * @Create 2023/5/10 18:49
 * @Version 1.0
 */
public class ThreadPoolUtil {

    private static ThreadPoolExecutor threadPoolExecutor;

    public static ThreadPoolExecutor getThreadPoolExecutor(){

        if (threadPoolExecutor == null){
            synchronized (ThreadPoolExecutor.class){
                if (threadPoolExecutor == null){
                    threadPoolExecutor= new ThreadPoolExecutor(4,
                            20, 5, TimeUnit.MINUTES,
                            new LinkedBlockingQueue<>());
                }
            }
        }

        return threadPoolExecutor;
    }

    public static void main(String[] args) {

    }
}
